home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / qbsnip.zip / SPRMASK.BAS < prev    next >
BASIC Source File  |  1997-01-22  |  2KB  |  50 lines

  1. ' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. ' MASK.BAS  by  Dave Shea
  3. ' Released to Public Domain on January 19th, 1997.
  4. '
  5. ' Compile: MicroSoft Quick Basic 4.5, PDS 7.1
  6. '
  7. ' Desc: Demonstrates the technique of masking a graphics array.
  8. '
  9. ' (Use at your own risk)
  10. ' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  11.  
  12. CLS : SCREEN 13
  13. DIM Circ%(1557), MCirc%(1557)
  14.  
  15. TCol = 0                             'Color to be transparent
  16.                                      '(I ALWAYS use 0)
  17. MCol = 255                           'Mask color
  18.  
  19. FOR a = 15 TO 1 STEP -1
  20.  CIRCLE (160, 100), a * 2, a         'Draw the circle
  21.  PAINT (160, 100), a
  22. NEXT
  23.  
  24. GET (130, 75)-(190, 125), Circ%      'Store it in array Circ%
  25.  
  26. FOR a = 130 TO 190
  27.  FOR b = 75 TO 125
  28.                     'The following commands search the circle, and
  29.                     'change any pixel that's NOT the transparent
  30.                     'color to the transparent color, and any pixel
  31.                     'that IS the transparent color to the mask color
  32.                     '(This is the masking process)
  33.  
  34.   IF POINT(a, b) = TCol THEN PSET (a, b), MCol
  35.   IF POINT(a, b) <> TCol AND POINT(a, b) <> MCol THEN PSET (a, b), TCol
  36.  NEXT
  37. NEXT
  38.  
  39. GET (130, 75)-(190, 125), MCirc%      'Get the new Masked Circle
  40.  
  41. CLS
  42.  
  43. FOR a = 1 TO 200
  44.  LINE (1, a)-(320, a), a              'Draw some lines for a background
  45. NEXT
  46.  
  47. PUT (130, 75), MCirc%, AND            'Lay down the mask using AND
  48. PUT (130, 75), Circ%, XOR             'Lay down circle using XOR
  49.                                       '(which is the default for PSET)
  50.